﻿package test.ui {
	import flash.display.MovieClip;
	import flash.display.Sprite;
	import flash.text.TextField;
	import gear.ui.cell.GCell;
	import gear.ui.cell.GCellData;
	import gear.ui.skin.tb.MCToggleButtonSkin;


	/**
	 * @author admin
	 */
	public class TestCell extends GCell {
		private var _lock : Sprite;
		private var _label_tf : TextField;

		override protected function create() : void {
			super.create();
			addLock();
			addTextField();
		}

		private function addLock() : void {
			var mc : MovieClip = MCToggleButtonSkin(_data.skin).mc;
			mc.gotoAndStop(1);
			_lock = mc.getChildByName("lock") as Sprite;
		}

		private function addTextField() : void {
			var mc : MovieClip = MCToggleButtonSkin(_data.skin).mc;
			mc.gotoAndStop(1);
			_label_tf = mc.getChildByName("label_tf") as TextField;
		}

		public function TestCell(data : GCellData) {
			super(data);
		}

		override public function set lock(value : Boolean) : void {
			_lock.visible = value;
		}

		override public function set source(value : *) : void {
			if (value == null) {
				_label_tf.text = "";
			} else {
				_label_tf.text = value;
			}
			_source = value;
			enabled = (_source != null);
		}
	}
}
